<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>我的话题</title>
    <link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/css/mian.css}">

    <script type="text/javascript" th:src="@{/layui/blog.js}"></script>
    <script type="text/javascript" th:src="@{/layui/layui.js}"></script>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
</head>
<body class="lay-blog">
<!--菜单-->
<ul class="layui-nav layui-bg-blue" lay-filter="">
    <li class="layui-nav-item "><a href="/" style="font-size: 20px">首页</a></li>
    <li class="layui-nav-item">
        <a href="javascript:;" style="font-size: 20px">习题库</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd>
                <a th:href="@{/item/chapter/overview}">分章节练习</a>
            </dd>
            <dd>
                <a th:href="@{/item/overview}">分题型练习</a>
            </dd>
        </dl>
    </li>
    <li class="layui-nav-item">
        <a href="javascript:;" style="font-size: 20px">课程分类</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd>
                <a th:href="@{'/course/type_show/'+${coursetype.getId()}}" th:each="coursetype:${coursetypes}" th:text="${coursetype.getCourse_name()}"></a>
            </dd>
            <dd>
                <a th:href="@{/course/type_show/0}" >全部课程</a>
            </dd>
        </dl>
    </li>
    <li class="layui-nav-item layui-this" th:if="${session.loginuser} == null"><a th:href="@{/community/index}" style="font-size: 20px">社区</a></li>
    <li class="layui-nav-item layui-this" th:if="${session.loginuser} != null">
        <a href="javascript:;" style="font-size: 20px">社区</a>
        <dl class="layui-nav-child">
            <dd><a th:href="@{/community/index}">社区首页</a></dd>
            <dd><a th:href="@{/stu/community/commenting}">发布话题</a></dd>
            <dd><a th:href="@{/stu/community/management}">我的话题</a></dd>
            <dd><a th:href="@{/stu/chat_all}" target="_blank">头脑风暴</a></dd>
        </dl>
    </li>
    <li class="layui-nav-item"><a th:href="@{/file/list}" style="font-size: 20px">资料干货</a></li>

    <!--如果没有登录-->
    <li class="layui-nav-item" th:if="${session.loginuser} == null">
        <a th:href="@{/login}" style="font-size: 20px">登录</a>
    </li>
    <li class="layui-nav-item" th:if="${session.loginuser} == null">
        <a th:href="@{/register}" style="font-size: 20px">注册</a>
    </li>
    <!--如果没有登录-->

    <!--如果登录-->
    <li class="layui-nav-item" th:if="${session.loginuser} != null">
        <a href="javascript:;" style="font-size: 20px">我的班级</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd>
                <a th:href="@{/stu/map/show}">班级签到</a>
            </dd>
            <dd>
                <a th:href="@{/stu/exam/overview}">班级考试</a>
            </dd>
            <dd>
                <a th:href="@{/stu/exam/mydegree/list}">我的考试成绩</a>
            </dd>
        </dl>
    </li>
    <li class="layui-nav-item" th:if="${session.loginuser} != null">
        <a href="javascript:;" style="font-size: 20px">好友管理</a>
        <dl class="layui-nav-child"> <!-- 二级菜单 -->
            <dd>
                <a th:href="@{/stu/friends/list}">好友列表</a>
            </dd>
            <dd>
                <a th:href="@{/stu/friends/search}">搜索好友</a>
            </dd>
        </dl>
    </li>
    <li class="layui-nav-item" th:if="${session.loginuser} != null">
        <img th:src="@{'/show/'+${session.loginuser.getId()}}" class="layui-nav-img">[[${session.loginuser.username}]]
        <dl class="layui-nav-child">
            <dd><a th:href="@{/stu/center}">个人中心</a></dd>
            <dd><a th:href="@{/stu/logout}">退出</a></dd>
        </dl>
    </li>

    <!--如果登录-->
</ul>
<!--菜单-->


<div class="container-wrap">
    <div class="container">
        <div class="contar-wrap">
            <h4 class="item-title">
                <p><i class="layui-icon layui-icon-speaker"></i>公告：<span>各位同学注意文明用语，营造一个良好的社区学习环境</span></p>
            </h4>
            <div class="item" th:each="blog:${blogs}" th:data="${blog.getId()}" th:praise="${blog.getPraise()}">
                <div class="item-box  layer-photos-demo1 layer-photos-demo">
                    <h2><a href="" th:text="${blog.getSubject()}"></a></h2>
                    <h4><span><a href="" th:text="${blog.getUsername()}"></a><img class="layui-nav-img" th:src="@{'/show/'+${blog.getUser_id()}}" ></span></h4>
                    <h5>发布于：<span th:text="${#dates.format(blog.getCreatetime(),'yyyy年MM月dd日 HH:mm')}"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i class="layui-icon layui-icon-praise"></i><em class="myem123" th:text="${blog.getPraise()}"></em></h5>
                    <!--                    <input type="hidden" class="mypraise" th:value="${blog.getPraise()}">-->
<!--                    <p th:text="${blog.getContent()}"></p>-->
                    <!--                    <img th:src="@{/images/item.png}" alt="">-->
                </div>
                <div class="comment count" >
                    <a th:href="@{'/stu/community/getmyindex/'+${blog.getId()}}"><i class="layui-icon layui-icon-edit"></i>修改</a>
                    <a th:href="@{'/stu/community/delete/'+${blog.getId()}}"><i class="layui-icon layui-icon-delete"></i>删除(侠客慎重)</a>
                </div>
            </div>
        </div>
    </div>
</div>
<!--底部-->
<div class="footer">
    <p>
        <span>&copy; 2020</span>
        <span><a href="http://120.78.82.248:8080" target="_blank">计算机网络课程资源共享网</a></span>
        <span>王侃</span>
    </p>
    <p><span>长风破浪会有时，直挂云帆济沧海</span></p>
</div>
<!--底部-->

</body>
<script>
    // $(document).ready(function () {
    //     $('.item').click(function () {
    //         var this_id=$(this).attr('data');
    //         var mypraise=$(this).attr('praise');
    //         var praise2=parseInt(mypraise)+1;
    //         console.log(praise2);
    //         // $(this).children('em').text(praise2);
    //
    //         $.post(
    //             '/stu/community/praise',
    //             {'id':this_id},
    //             function (result) {
    //
    //             }
    //         );
    //     })
    // })
    //注意：导航 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;

        //…
    });
</script>
</html>